﻿
#ifndef PICTURETCPCLIENT_H
#define PICTURETCPCLIENT_H

#include <QWidget>
#include<QtNetwork>
#include<QTcpSocket>
#include<QFileDialog>
#include<QMessageBox>
#pragma execution_character_set("utf-8")

QT_BEGIN_NAMESPACE
namespace Ui { class PictureTcpClient; }
QT_END_NAMESPACE

class PictureTcpClient : public QWidget
{
    Q_OBJECT

public:
    PictureTcpClient(QWidget *parent = nullptr);
    ~PictureTcpClient();

    void InitTcp();
    void ChangeEnable(bool isEnable);
    void ConnectToServer();     //连接服务器
    void SendData();            //发送数据
    QStringList GetFileNames(QString filter);   //获取打开对话框中指定格式的文件列表
    void DelayTime(int ms);                     //延时等待功能
    QByteArray GetPicData(QString fromPic);

private slots:
    void on_btnConnect_clicked();

    void on_btnDisConnect_clicked();

    void on_btnSend_clicked();

    void on_btnSelectImg_clicked();

    void on_btnClear_clicked();

    void on_btnSendImg_clicked();

    void conSuc();              //连接成功
    void ReadData();            //读取数据
    void DisplayError(QAbstractSocket::SocketError);

private:
    Ui::PictureTcpClient *ui;

    QTcpSocket *m_tcpClient;
};

#endif // PICTURETCPCLIENT_H
